# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models
import datetime


# Create your models here.


# 权限等级(普通管理员，超级管理员)
class PocUserRank(models.Model):
    rank_id=models.IntegerField(primary_key=True)
    rank_value=models.CharField(max_length=50)

# 系统用户
class PocUser(models.Model):
    user_id = models.AutoField(primary_key=True)
    user_name = models.CharField(max_length=50, unique=True)
    user_pass = models.CharField(max_length=50)
    user_rank = models.ForeignKey(PocUserRank, related_name='poc_userrank_fk', null=True)
    insert_time = models.DateTimeField(default=datetime.datetime.today(), null=True)

# 参数 重要程度 (跟进 关注 了解 重要 战略)
class Importance(models.Model):
    param_id = models.IntegerField(primary_key=True)
    param_value = models.CharField(max_length=20)


# 参数 事业部 (东区 西区 南区 北区 中区 西北)
class Department(models.Model):
    param_id = models.IntegerField(primary_key=True)
    param_value = models.CharField(max_length=50)


# 参数 落单情况 (跟进 暂停 中标 取消 失败 放弃)
class Progress(models.Model):
    param_id = models.IntegerField(primary_key=True)
    param_value = models.CharField(max_length=20)


# poc 信息
class Poc(models.Model):
    poc_id = models.AutoField(primary_key=True)
    customer_name = models.CharField(max_length=50)
    importance = models.ForeignKey(Importance, related_name='poc_importance_fk', null=True)
    project_name = models.CharField(max_length=100)
    department = models.ForeignKey(Department, related_name='poc_department_fk', null=True)
    manager = models.CharField(max_length=50)
    solution = models.CharField(max_length=50)
    module = models.CharField(max_length=20)
    progress = models.ForeignKey(Progress, related_name='poc_progress_fk', null=True)
    poc_status = models.CharField(max_length=100, default='')
    exchange_time = models.DateTimeField(default=datetime.datetime.today(), null=True)
    exchange_persons = models.CharField(max_length=200)
    last_update = models.DateTimeField(default=datetime.datetime.today(), null=True)
    budget = models.IntegerField(default=0)
    flag = models.CharField(max_length=1, default='N')
    work_load = models.CharField(max_length=50)
    instruction = models.CharField(max_length=500)
    data_collection = models.CharField(max_length=500)
    poc_user = models.ForeignKey(PocUser,related_name='poc_poc_user_fk',null=True)


# poc 跟踪信息
class PocTrack(models.Model):
    track_id = models.AutoField(primary_key=True)
    track_time = models.DateTimeField(default=datetime.datetime.today())
    activity = models.CharField(max_length=1000)
    instruction = models.CharField(max_length=500)
    poc = models.ForeignKey(Poc, related_name='track_poc_fk', null=True)
